/**
 * @addtogroup gbc_msg_17691
 * gb_17691_msg_sd
 * @brief        山东地标消息
 * @par 示例
 * @code
   // 包含国六山东地标扩展的消息
   // 防篡改备案消息中的芯片ID和正式公钥通过加密接口IGbc17691Encrypt获得
   // 消息中时间格式为byte形式
   //参考 gbc_17691_msg_gb.h的使用示例

 * @endcode
 * @{
 */
/**
 * @file         gbc_17691_msg_sd.h
 * @brief        山东地标消息
 * @note         
 * @author       Dengdeshou
 * @date         2020-08-07
 * @version      1.0
 *
 * @par          修改日志
 * <table>
 * <tr><th>Date        <th>Version               <th>Author          <th>Description
 * <tr><td>2020-08-19  <td>1.0                   <td>Dengdeshou      <td>创建初始版本
 * @copyright    杭州鸿泉物联网技术股份有限公司
 */
#ifndef _SCC_PT17691_MSG_SD_H_
#define _SCC_PT17691_MSG_SD_H_

#include "ofc/ofc_object.h"
#include "ofc/ofc_list.h"
#include "mfc/mfc_string.h"
#include "gbmsg17691/gbc_17691_msg.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * 山东地标命令字
 */
typedef enum TGbc17691CmdSdEnumTag TGbc17691CmdSdEnum;
enum TGbc17691CmdSdEnumTag
{
    kGbc17691CmdBreakAlarm = 0x06,      ///< 拆除报警
    kGbc17691CmdKeepOnRecord = 0x07,    ///< 防篡改备案
    kGbc17691CmdRecordAck = 0x08,       ///< 防篡改备案应答
    kGbc17691CmdLoginAck = 0x80,        ///< 登入应答
};
/**
 * 车辆拆除报警信息(cmd = 0x06)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgBreakAlarmTag TGbc17691MsgBreakAlarm;
struct TGbc17691MsgBreakAlarmTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 logout_time[6];               ///< 登出时间 
    UInt16 logout_seqid;                ///< 流水号
    UInt8 location_state;               ///< 定位状态           
    UInt32 longitude;                   ///< 经度
    UInt32 latitude;                    ///< 纬度
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgBreakAlarmCreate(TGbc17691MsgBreakAlarm *self);

/**
 * 数据防篡改备案(cmd = 0x07)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgKeepOnRecordTag TGbc17691MsgKeepOnRecord;
struct TGbc17691MsgKeepOnRecordTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 collect_time[6];              ///< 数据采集时间 
    UInt8 chip_id[16];                  ///< 芯片ID
    UInt8 public_key[64];               ///< 公钥           
    TGbc17691Signature signature;       ///< 数字签名
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgKeepOnRecordCreate(TGbc17691MsgKeepOnRecord *self);

/**
 * 备案状态
 */
enum TGbc17691ReocordStateEnumTag
{
    kGbc17691RecordStateSucess = 1,   ///< 备案成功
    kGbc17691RecordStateFail = 2,     ///< 备案失败
};
typedef enum TGbc17691ReocordStateEnumTag TGbc17691ReocordStateEnum;

/**
 * 备案信息
 */
enum TGbc17691ReocordInfoEnumTag
{
    kGbc17691RecordInfoSucess = 0,      ///< 备案成功
    kGbc17691RecordInfoChipAlready = 1, ///< 芯片已备案
    kGbc17691RecordInfoVinError = 2,    ///< VIN错误
};
typedef enum TGbc17691ReocordInfoEnumTag TGbc17691ReocordInfoEnum;
/**
 * 备案结果应答(cmd = 0x08)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgRecordAckTag TGbc17691MsgRecordAck;
struct TGbc17691MsgRecordAckTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt8 record_state;                   ///< 状态码,参考TGbc17691ReocordStateEnum
    UInt8 record_info;                    ///< 信息，参考TGbc17691ReocordInfoEnum
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgRecordAckCreate(TGbc17691MsgRecordAck *self);

/**
 * 登入结果
 */
enum TGbc17691LoginResultEnumTag
{
    kGbc17691LoginResultSucess = 1,      ///< 成功
    kGbc17691LoginResultFail = 2,        ///< 失败
};
typedef enum TGbc17691LoginResultEnumTag TGbc17691LoginResultEnum;
/**
 * 登入平台结果应答(cmd = 0x80)
 ********************************************************************************************
 */
typedef struct TGbc17691MsgLoginResultTag TGbc17691MsgLoginResult;
struct TGbc17691MsgLoginResultTag
{
PROTECTED
    TGbc17691Msg parent_;               ///< 基类  
    TOfVirtualMethod Destroy_;          ///< 析构事件

PUBLIC
    UInt16 login_seq_id;                ///< 登入流水号
    UInt8 login_result;                 ///< 登入结果,参考TGbc17691LoginResultEnum
    UInt8 sm2_public_key[64];           ///< 非对称加密公钥
};

/**
 * 构造函数
 * @param self: 对象指针
 * @return
 */
void TGbc17691MsgLoginResultCreate(TGbc17691MsgLoginResult *self);

#ifdef __cplusplus
}
#endif

#endif

/**
 * @} 
 */
